<?php
$entity = get_entity(get_input('o'));

//Icons
$iconLarge 	= elgg_view_entity_icon($entity, 'large', array('href' => ''));
$iconMedium = elgg_view_entity_icon($entity, 'medium', array('href' => ''));
$iconSmall 	= elgg_view_entity_icon($entity, 'small', array('href' => ''));
$iconTiny 	= elgg_view_entity_icon($entity, 'tiny', array('href' => ''));

//Back button
if(get_context() == 'admin'){$backLink = "/admin/organizations/list";}
else {$backLink = "/organizations/profile/".$entity->guid;}
?>

<?php
/* 
echo elgg_view('output/url',
array('href'=> $backLink, 'text' => '<- Atras','class' => 'elgg-button elgg-button-cancel')); /* */ ?><br>

<label for="f1"><?php echo $iconLarge.$iconMedium.$iconSmall.$iconTiny?><br>
	<?php echo elgg_view("input/file", array('name' => 'icon', "id" => "f1")); ?>
</label><br>

<label for="f2">Nombre 
	<?php echo elgg_view('input/text', 
		array('id' => 'f2', 'name' => 'name','value' => isset($entity->guid) ? $entity->title : '',)); 
	?>
</label><br>
<label for="f7">CIF/NIF 
	<?php echo elgg_view('input/text', 
		array('id' => 'f7', 'name' => 'cif','value' => isset($entity->guid) ? $entity->cif : '',)); 
	?>
</label><br>

<label for="f4">Direcci&oacute;n
	<?php echo elgg_view('input/text', 
		array('id' => 'f4', 'name' => 'address', 'value' => isset($entity->guid) ? $entity->address : '',));
	?>
</label><br>
<label for="f5">Tel&eacute;fono
	<?php echo elgg_view('input/text', 
		array('id' => 'f5', 'name' => 'phone', 'value' => isset($entity->guid) ? $entity->phone : '',));
	?>
</label><br>
<label for="f6">P&aacute;gina Web
	<?php echo elgg_view('input/url', 
		array('id' => 'f6', 'name' => 'web', 'value' => isset($entity->guid) ? $entity->web : '',));
	?>
</label><br>

<label for="f3">Descripci&oacute;n
	<?php echo elgg_view('input/longtext', 
		array('id' => 'f3', 'name' => 'description', 'value' => isset($entity->guid) ? $entity->description : '',));
	?>
</label><br>

<?php
//Hidden guid of the entity
echo elgg_view('input/hidden', 
array('name' => 'guid', 'value' => isset($entity->guid) ? $entity->guid : '',));

echo elgg_view('input/submit',array('value' => 'Guardar', 'name' => 'save'));

if($entity->guid && get_context() == 'admin')
{
	echo elgg_view("output/confirmlink",
	array('href' => $vars['url'] . "action/organizations/delete?o=".$entity->guid,'text' => elgg_echo('delete'),
	'confirm' => elgg_echo('deleteconfirm'),'class' => 'elgg-button elgg-button-cancel',));
}
?>